﻿<link href="@Url.Content("~/content/table_btn.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/content/activitie_list.css")" rel="stylesheet" type="text/css"/>

<!--[if lt IE 8]>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
<![endif]-->

<noscript>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/content/activitie_noscript.css")" rel="stylesheet" type="text/css"/>
</noscript>

@model IEnumerable<PessModel.Activity>

@{
    ViewBag.Title = "活动";
}
<h2>活 动</h2>
@if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
{
    <div id="operate" class="formSearch">
    @using(Html.BeginForm("Index","Activity",FormMethod.Get)){
    <div>
        @Html.DropDownList("PessTypeID",(string)ViewBag.pessType) <input type="submit" value="搜索">
        &#8195;@Html.ActionLink("新建", "Create")
    </div>}
    </div>
}


<div id="itemList">
@foreach (var item in Model) {
    <dl onclick="window.location.href='/Activity/Details/'+this.id;" id=@item.ID>
        <dt>
            @*@Html.DisplayFor(modelItem => item.Name)*@
            @Html.ActionLink(item.Name,"Details", new { id=item.ID })
        </dt>
        <dd class="desc">
@*            @{
                string description = item.Description;
                description = description.StripHtmlTags();
                description = description.Truncate(150);                
              }
            @Html.DisplayFor(modelItem => description)*@
        </dd>
        <dd class="startTime">
            <!--[if lte IE 8]>
                开始时间：
            <![endif]-->
            @Html.DisplayFor(modelItem => item.StartDate)
        </dd>
        <dd class="dueTime">
            <!--[if lte IE 8]>
                开始时间：
            <![endif]-->
            @Html.DisplayFor(modelItem => item.DueDate)
        </dd>
        <dd class="pic">
            @Html.PhotoImage(string.Format("~/images/")+item.Status+".png")
            @*@Html.DisplayFor(modelItem=>item.Status)*@
        </dd>
        <dd class="link">
            @Html.ActionLink("详细", "Details", new { id=item.ID })
            @if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                <span> | </span>@Html.ActionLink("删除", "Delete", new { id=item.ID })
            }
        </dd>
    </dl>
}
</div>



<table style="display:none">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.StartDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DueDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AdminYear)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Status)
        </th>
@*        <th>
            @Html.DisplayNameFor(model => model.ProposalActivity.Name)
        </th>*@
        <th>
            @Html.DisplayNameFor(model => model.PessType.Name)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.StartDate)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DueDate)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AdminYear)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status)
        </td>
@*        <td>
            @Html.DisplayFor(modelItem => item.ProposalActivity.Name)
        </td>*@
        <td>
            @Html.DisplayFor(modelItem => item.PessType.Name)
        </td>
        <td>
            @Html.ActionLink("编辑", "Edit", new { id=item.ID }) |
            @*@Html.ActionLink("详细", "Details", new { id=item.ID }) |*@
            @Html.ActionLink("删除", "Delete", new { id=item.ID })
        </td>
    </tr>
}
</table>
